<!-- 
    @author Wójcik Karol <wojcikk@student.agh.edu.pl>
    @licence http://www.gnu.org/copyleft/gpl.html GNU/GPL
-->

<div id="colOne">
    <%= render :partial => "menu" %>
</div>
<div id="colTwo">

<% if @majors.blank? %>
    <h1>Aktualnie nie ma dost&#281;pnych kierunkow studiow</h1>
<% else %>

<h1>Kierunki</h1>

<table>
  <tr>
    <th><a href="/majors/?sortby=name">Nazwa</a></th>
    <th><a href="/majors/?sortby=study_type">Typ studi&#243;w</a></th>
    <th><a href="/majors/?sortby=faculty">Wydzia&#322;</a></th>
  </tr>
  
  
  
<% for major in @majors %>
  <tr>
  <% for column in Major.content_columns %>
    <td><%=h major.name %></td>
    <td><%=h major.study_type.name %></td>
	<td><%=h major.faculty.name %></td>
    </td>  
  <% end %>
    
    <td><%= link_to 'Poka&#380;', :action => 'show', :id => major %></td>
    <td><%= link_to 'Zmie&#324;', :action => 'edit', :id => major %></td>
    <td><%= link_to 'Usu&#324;', { :action => 'destroy', :id => major }, :confirm => 'Jeste&#347; pewny?', :post => true %></td>
  </tr>
<% end %>
</table>

<%= link_to 'Previous page', { :page => @major_pages.current.previous } if @major_pages.current.previous %>
<%= link_to 'Next page', { :page => @major_pages.current.next } if @major_pages.current.next %> 
<% end %>
<br />

<%= link_to 'Utw&#243;rz nowy', :action => 'new' %>

</div>